﻿@using pdtransport_v2._0.Areas.back.Controllers

@{
    ViewBag.Title = "DanhSach";
    Layout = "~/Areas/back/Views/Shared/_back_layout.cshtml";
}

<h2>
Danh sách nhân viên</h2>
<br />
<div class="dataTables_filter" id="example_filter">
<form class="form-search" method="get" action="../Danhsach">
<input name="keyword" type="text" placeholder="Từ khóa"/>
<button type="submit" class="btn btn-small btn-blue">Tìm</button>
</form>
</div>

@if (@ViewBag.Xoa == 1)
{
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">
            ×</button>
        <h4>
            Thành Công!</h4>
        Chỉnh sửa thông tin thành công.
    </div>
}

<p>
    @Html.ActionLink("Thêm mới", "Them", "Nhanvien", new { @class = "btn btn-small btn-blue"})
</p>

<table class="data display datatable">
<thead>
    <tr>
        <th class="sorting_asc">
            Mã Nhân viên
        </th>
        <th class="sorting">
            Họ Tên
        </th>
        <th class="sorting">
            Username
        </th>
        <th class="sorting">
            Vai Trò
        </th>
        <th class="sorting">
            Tình Trạng
        </th>
        <th width="7%">
        </th>
        <th width="7%">
        </th>
    </tr>
</thead>
<tbody>
@if (ViewBag.total_row == 0)
{
    <tr class="gradeA odd">
        <td colspan="5" class="align-center">
            Không có kết quả phù hợp
        </td>
    </tr>
}
@foreach (var item in ViewBag.nhanviens as List<nv_tk>)
{
    <tr class="gradeA odd">
        <td>
            @item.nv.MaNV
        </td>
        <td>
            @item.nv.HoTen
        </td>
        <td>
            @item.tk.username
        </td>
        <td>
            @item.tk.VaiTro
        </td>
        <td>
            @if (item.tk.TinhTrang == 1)
            {
                <p class="green">Enabled</p>

            }
            else
            {
                <p class="red">Disabled</p>
            }
        </td>
        <td>
            @Html.ActionLink("Sửa", "Sua", "Nhanvien", new { id = item.nv.IDNV }, new { @class = "btn btn-small btn-blue" })
        </td>
        <td>
        @if (item.tk.TinhTrang == 1)
        {
            @Html.ActionLink("Xóa", "Xoa", "Nhanvien", new { id = item.nv.IDNV }, new { @class = "btn btn-small btn-red delete-row" })
        }
        else
        {
            @Html.ActionLink("Xóa", "", "", new { id = item.nv.IDNV }, new { @class = "btn btn-small btn-red disabled" })
        }
        </td>
    </tr>
}
</tbody>
</table>

<div class="pagination clearfix">
        @if ((string)ViewData["pageLinks"] != "")
        {
            <ul>
                @Html.Raw(ViewBag.pageLinks)
            </ul>
            <br />
            <br />
        }
    </div>
